<template>
	<view class='dispute-box'>
		<view class='card-box'>
			<view class='title'>[温馨提示]</view>
			<view class='content-box'>您好，目前鞍心宠认证仅对于优质繁育商或门店进行开放您如有需要，可与我们取得联系，谢谢!</view>
		</view>
		
		<view class='form-box'>
			<view class='form-title'>请填写</view>
			<view class='form'>
				<view class='form-item'>
					<view class='label'>繁育商/门店名称</view>
					<view class="input-box">
						<input class='input' v-model='form.name' maxlength="20" placeholder="请输入繁育商/门店名称" placeholder-class='dispute-placeholder'></input>
					</view>
				</view>
				<view class='form-item'>
					<view class='label'>联系人</view>
					<view class="input-box">
						<input class='input' v-model='form.linker' maxlength="20" placeholder="请输入联系人姓名" placeholder-class='dispute-placeholder'></input>
					</view>
				</view>
				<view class='form-item'>
					<view class='label'>联系电话</view>
					<view class="input-box">
						<input class='input' v-model='form.linkphone'  maxlength="11" placeholder="请输入联系方式" placeholder-class='dispute-placeholder'></input>
					</view>
				</view>
				
				<view class='submit' @click='handleSubmit'>提交</view>
			</view>
		</view>
	</view>
</template>

<script>
	import regRules from '@/common/rules'
	import {addApply} from '@/api/pet/apply/index'
	export default {
		data() {
			return {
				form: {
					name: undefined,
					linker: undefined,
					linkphone: undefined
				}
			}
		},
		methods: {
			handleSubmit() {
				if(!this.form.name) return uni.showToast({title: '请输入繁育商/门店名称',icon: 'none'})
				if(!this.form.linker) return uni.showToast({title: '请输入联系人姓名',icon: 'none'})
				if(!this.form.linker) return uni.showToast({title: '请输入联系方式',icon: 'none'})
				if(!regRules.phone.test(this.form.linkphone)) return uni.showToast({title: '手机号格式不正确',icon: 'none'})
				addApply(this.form).then(res => {
					this.form.name = undefined
					uni.showToast({title: '提交成功',icon: 'none'})
				})
			}
		}
	}
</script>

<style>
	.dispute-placeholder {
		color: #BBBBBB;
	}
</style>
<style scoped lang="scss">
	.dispute-box {
		background: linear-gradient( 180deg, #FFFFFF 0%, #F8F8F8 100%);
		padding: 0 16rpx;
	}
	
	.card-box {
		width: 100%;
		background: linear-gradient( 180deg, #FFF6E5 0%, #FFFCF7 100%);
		border-radius: 16rpx;
		border: 2rpx solid #FFFFFF;
		padding: 24rpx;
		
		.title {
			font-weight: 600;
			font-size: 30rpx;
			color: #FF5A02;
			line-height: 42rpx;
		}
		
		.content-box {
			font-size: 28rpx;
			color: var(--btnColor);
			line-height: 40rpx;
			margin-top: 12rpx;
		}
	}
	
	.form-box {
		padding-top: 32rpx;
		padding-bottom: 32rpx;
		
		.form-title {
			font-weight: 600;
			font-size: 34rpx;
			color: var(--btnColor);
			display: flex;
			align-items: center;
			
			&:before {
				content: '';
				display: block;
				width: 8rpx;
				height: 32rpx;
				background: var(--primaryBg);
				border-radius: 9rpx;
				margin-right: 8rpx;
			}
		}
		
		.form {
			margin-top: 24rpx;
			background: #FFFFFF;
			border-radius: 32rpx;
			padding: 0 24rpx 32rpx 24rpx;
			
			.form-item {
				display: flex;
				padding: 40rpx 0;
				border-bottom: 2rpx solid #EEEEEE;
				
				.label {
					font-weight: 600;
					font-size: 30rpx;
					color:var(--h1Color);
					line-height: 42rpx;
					margin-right: 20rpx;
				}
				
				.input-box {
					flex: 1;
					
					.input {
						width: 100%;
						font-size: 30rpx;
						text-align: right;
					}
				}
			}
			
			.submit {
				margin-top: 64rpx;
				width: 100%;
				height: 96rpx;
				background: var(--primaryBg);
				border-radius: 48rpx;
				font-weight: 600;
				font-size: 32rpx;
				color: var(--btnColor);
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}
</style>